<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use app\middleware\Jwt;
use app\middleware\Auth;
use app\middleware\Shaper;
use think\facade\Route;

// 根目录
Route::get('/', function () {
    return 'Hello World, PHP Language Is No.1';
});
// 登录
Route::post('api/login', 'user.IndexController/login');

// 后端服务
Route::group('api', function () {
    // 退出
    Route::get('logout', 'user.IndexController/logout');
    // 首页
    Route::get('index', 'index.IndexController/index');
})->middleware([Jwt::class, Auth::class, Shaper::class]);

// 路由不存在
Route::miss(function () {
    return json(result()->setMsg('路由不存在')->fail());
});